package clickme.jiaxa.clickme;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private EditText etPhone;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        /*设置内容UI，把界面加载出来*/


        setContentView(R.layout.main_activity);
        //        Toast.makeText(this, "haha", Toast.LENGTH_SHORT).show();

        /*alt + enter 选择强转换*/
        //        Button btnClick = (Button) findViewById(R.id.btnClick);
       /* btnClick.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                System.out.println("haha,我被点击了");
                Toast.makeText(MainActivity.this, "haha", Toast.LENGTH_SHORT).show();
            }
        });*/

       /*第二中点击事件*/
        /*btnClick.setOnClickListener(new btnClickListener());*/

        /*第三种点击事件*/
        //        btnClick.setOnClickListener(this);


        /*Ctrl + alt + F 转换为一个属性字段*/
        etPhone = (EditText) findViewById(R.id.etPhone);
        Button btnPhone = (Button) findViewById(R.id.btnPhone);


    }

    @Override
    public void onClick(View v) {
        System.out.println("哈哈，我你");
        Toast.makeText(MainActivity.this, "haha", Toast.LENGTH_SHORT).show();
    }

    class btnClickListener implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            System.out.println("哈哈，我你没点击了");
            Toast.makeText(MainActivity.this, "haha", Toast.LENGTH_SHORT).show();
        }
    }

    class btnPhoneListener implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            etPhone.getText().toString().trim();
        }
    }
}
